﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Protegidos/Pessoas/GENTE_PesDt.master" AutoEventWireup="true" CodeFile="pContEnd.aspx.cs" Inherits="Protegidos_Pessoas_DadosPessoa_pContEnd" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphSubConteudo" Runat="Server">

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">

    function ShowInsertEndereco() {
        window.radopen("_popup/ppEndereco.aspx", "RadWindow1");
        return false;
    }
    function ShowInsertTelefone() {
        window.radopen("_popup/ppTelefone.aspx", "RadWindow2");
        return false;
    }
    function ShowInsertEmail() {
        window.radopen("_popup/ppEmail.aspx", "RadWindow3");
        return false;
    }

    function ShowUpdateEndereco(id) {
        window.radopen("_popup/ppEndereco.aspx?Id=" + id, "RadWindow1");
        return false;
    }
    function ShowUpdateTelefone(id) {
        window.radopen("_popup/ppTelefone.aspx?Id=" + id, "RadWindow2");
        return false;
    }
    function ShowUpdateEmail(id) {
        window.radopen("_popup/ppEmail.aspx?Id=" + id, "RadWindow3");
        return false;
    }
    
    function refreshGrid(arg) {
        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("arg");
    }
</script>
</telerik:RadCodeBlock>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridEndereco" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridTelefone" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridEmail" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting> 
         
    <telerik:AjaxSetting AjaxControlID="gridEndereco">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridEndereco" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>                                                             
    
    <telerik:AjaxSetting AjaxControlID="gridTelefone">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridTelefone" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>
    
    <telerik:AjaxSetting AjaxControlID="gridEmail">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="gridEmail" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
    </telerik:AjaxSetting>
    
</AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Telerik" >
</telerik:RadAjaxLoadingPanel> 

<telerik:RadWindowManager ID="RadWindowManager2" runat="server">
    <Windows>
        <telerik:RadWindow  ID="RadWindow1" runat="server" Height="450px" Width="500px" ReloadOnShow="true" Modal="true"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Behaviors="Close, Move, Resize, Maximize" />
    </Windows>
    <Windows>
        <telerik:RadWindow  ID="RadWindow2" runat="server" Height="300px" Width="500px" ReloadOnShow="true" Modal="true"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Behaviors="Close, Move, Resize, Maximize" />
    </Windows>
    <Windows>
        <telerik:RadWindow  ID="RadWindow3" runat="server" Height="220px" Width="500px" ReloadOnShow="true" Modal="true"
            ShowContentDuringLoad="false" VisibleStatusbar="false" Behaviors="Close, Move, Resize, Maximize" />
    </Windows>
</telerik:RadWindowManager>

<table width="99%" align="center">
    <tr>
        <td>
            <div class="Titulo01">Contatos/Endereços</div>
            <div class="Titulo02">Pessoas</div>
        </td>    
    </tr>
    <tr>
        <td>
        
            <table width="100%" align="right">
                <tr>
                    <td>
                    
                        <table width="100%" class="textoCZ_12B" align="right">
                            <tr>
                                <td>
                                    <div class="subTitulo_pagina">Endereços</div>
                                    <div class="espaco"></div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                
                                    <telerik:RadGrid ID="gridEndereco" runat="server" AllowPaging="True" Width="100%" Skin="Telerik" 
                                        ondeletecommand="gridEndereco_DeleteCommand">
                                        <PagerStyle Mode="NumericPages" />
                                        <MasterTableView AutoGenerateColumns="False" DataKeyNames="IdPessoaEndereco" ClientDataKeyNames="IdPessoaEndereco" Width="100%" CommandItemDisplay="Top" PageSize="10">
                                            <Columns>
                                                
                                                <telerik:GridTemplateColumn>
                                                    <ItemTemplate>
                                                        <span style="font-weight: bold;">Tipo: </span><%# Eval("TipoEndereco.Descricao")%>
                                                        <br /><span style="font-weight: bold;">Endereço: </span><%# Eval("TipoLogradouro.Descricao")%> <%# Eval("Logradouro")%>, <%# Eval("Numero")%>
                                                        <br /><span style="font-weight: bold;">Complemento: </span><%# Eval("Complemento")%>
                                                        <br /><span style="font-weight: bold;">Bairro: </span><%# Eval("Bairro")%>
                                                        <br /><span style="font-weight: bold;">Cidade/Uf: </span></span><%# Eval("Cidade.NomeCidade")%> / <%# Eval("Cidade.Uf.Sigla")%>
                                                        <br /><span style="font-weight: bold;">CEP: </span><%# Eval("Cep")%>
                                                        <br /><span style="font-weight: bold;">Status: </span><%# Eval("StatusEndereco.Descricao")%>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                
                                                <telerik:GridBoundColumn Visible="false" DataField="IdPessoaEndereco" HeaderText="IdPessoaEndereco" UniqueName="IdPessoaEndereco"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="IdPessoa" HeaderText="IdPessoa" UniqueName="IdPessoa"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="TipoLogradouro.Descricao" HeaderText="TipoLogradouro.Descricao" UniqueName="TipoLogradouro.Descricao"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="TipoEndereco.Descricao" HeaderText="TipoEndereco.Descricao" UniqueName="TipoEndereco.Descricao"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Numero" HeaderText="Numero" UniqueName="Numero"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Complemento" HeaderText="Complemento" UniqueName="Complemento"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Bairro" HeaderText="Bairro" UniqueName="Bairro"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Cidade.NomeCidade" HeaderText="Cidade.NomeCidade" UniqueName="Cidade.NomeCidade"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Cep" HeaderText="Cep" UniqueName="Cep"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="StatusEndereco.Descricao" HeaderText="StatusEndereco.Descricao" UniqueName="StatusEndereco.Descricao"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Path" HeaderText="Path" UniqueName="Path"></telerik:GridBoundColumn>
                                                
                                                <telerik:GridHyperLinkColumn DataTextFormatString="Editar" HeaderStyle-Width="60px"
                                                    DataNavigateUrlFields="IdPessoaEndereco" UniqueName="IdPessoaEndereco" DataNavigateUrlFormatString="javascript: ShowUpdateEndereco({0})"
                                                    DataTextField="IdPessoaEndereco">
                                                </telerik:GridHyperLinkColumn>
                                                <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Remover" CommandName="Delete" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="60px"></telerik:GridButtonColumn>
                                            </Columns>
                                            <CommandItemTemplate>
                                                <!-- -->
                                                <table border="0" style="width: 100%;" class="rgCommandTable">
	                                                <tbody>
	                                                    <tr>
		                                                    <td align="left">
		                                                        <input class="rgAdd" type="button" title=" Adicionar Endereço" onclick="return ShowInsertEndereco();" />
                                                                <a href="#" onclick="return ShowInsertEndereco();">Adicionar Endereço</a>
		                                                    </td>
	                                                    </tr>
                                                    </tbody>
                                                </table>
                                                <!-- -->
                                            </CommandItemTemplate>
                                        </MasterTableView>
                                    </telerik:RadGrid>
                                
                                </td>
                            </tr>
                        </table>
                        
                        <table width="100%" class="textoCZ_12B" align="right">
                            <tr>
                                <td>
                                    <div class="subTitulo_pagina">Telefones</div>
                                    <div class="espaco"></div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                
                                    <telerik:RadGrid ID="gridTelefone" runat="server" AllowPaging="True" Width="100%" Skin="Telerik"
                                        ondeletecommand="gridTelefone_DeleteCommand">
                                        <PagerStyle Mode="NumericPages" />
                                        <MasterTableView AutoGenerateColumns="False" DataKeyNames="IdTelefonePessoa" ClientDataKeyNames="IdTelefonePessoa" Width="100%" CommandItemDisplay="Top" PageSize="10">
                                            <Columns>
                                                
                                                <telerik:GridTemplateColumn>
                                                    <ItemTemplate>
                                                        <span style="font-weight: bold;">Tipo: </span><%# Eval("TipoTelefone.Descricao")%>
                                                        <br /><span style="font-weight: bold;">Telefone: </span>(<%# Eval("DddTelefone")%>) </span><%# Eval("Telefone")%>
                                                        <span style="font-weight: bold;">Ramal: </span><%# Eval("Ramal")%>
                                                        <br /><span style="font-weight: bold;">Nome Recado: </span><%# Eval("RecadoNome")%>
                                                        <br /><span style="font-weight: bold;">Status: </span><%# Eval("StatusTelefone.Descricao")%>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                    
                                                <telerik:GridBoundColumn Visible="false" DataField="IdTelefonePessoa" HeaderText="IdTelefonePessoa" UniqueName="IdTelefonePessoa"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="IdPessoa" HeaderText="IdPessoa" UniqueName="IdPessoa"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="TipoTelefone.Descricao" HeaderText="TipoTelefone.Descricao" UniqueName="TipoTelefone.Descricao"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="DddTelefone" HeaderText="DddTelefone" UniqueName="DddTelefone"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Telefone" HeaderText="Telefone" UniqueName="Telefone"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="Ramal" HeaderText="Ramal" UniqueName="Ramal"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="RecadoNome" HeaderText="RecadoNome" UniqueName="RecadoNome"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn Visible="false" DataField="StatusTelefone.Descricao" HeaderText="StatusTelefone.Descricao" UniqueName="StatusTelefone.Descricao"></telerik:GridBoundColumn>

                                                <telerik:GridHyperLinkColumn DataTextFormatString="Editar" HeaderStyle-Width="60px"
                                                    DataNavigateUrlFields="IdTelefonePessoa" UniqueName="IdTelefonePessoa" DataNavigateUrlFormatString="javascript: ShowUpdateTelefone({0})"
                                                    DataTextField="IdTelefonePessoa">
                                                </telerik:GridHyperLinkColumn>
                                                <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Remover" CommandName="Delete" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="60px"></telerik:GridButtonColumn>
                                            </Columns>
                                            <CommandItemTemplate>
                                                <!-- -->
                                                <table border="0" style="width: 100%;" class="rgCommandTable">
	                                                <tbody>
	                                                    <tr>
		                                                    <td align="left">
		                                                        <input class="rgAdd" type="button" title=" Adicionar Telefone" onclick="return ShowInsertTelefone();" />
                                                                <a href="#" onclick="return ShowInsertTelefone();">Adicionar Telefone</a>
		                                                    </td>
	                                                    </tr>
                                                    </tbody>
                                                </table>
                                                <!-- -->
                                            </CommandItemTemplate>
                                        </MasterTableView>
                                    </telerik:RadGrid>
                                
                                </td>
                            </tr>
                        </table>
                        
                        <table width="100%" class="textoCZ_12B" align="right">
                            <tr>
                                <td>
                                    <div class="subTitulo_pagina">E-mails</div>
                                    <div class="espaco"></div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                
                                    <telerik:RadGrid ID="gridEmail" runat="server" AllowPaging="True" Width="100%" Skin="Telerik"
                                        ondeletecommand="gridEmail_DeleteCommand">
                                        <PagerStyle Mode="NumericPages" />
                                        <MasterTableView AutoGenerateColumns="False" DataKeyNames="IdPessoaEmail" ClientDataKeyNames="IdPessoaEmail" Width="100%" CommandItemDisplay="Top" PageSize="10">
                                            <Columns>
                                                
                                                <telerik:GridBoundColumn DataField="Email" HeaderText="Email" UniqueName="Email"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="TipoEmail.Descricao" HeaderText="TipoEmail.Descricao" UniqueName="TipoEmail.Descricao"></telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Status.Descricao" HeaderText="Status.Descricao" UniqueName="Status.Descricao"></telerik:GridBoundColumn>
                                                
                                                <telerik:GridHyperLinkColumn DataTextFormatString="Editar" HeaderStyle-Width="60px"
                                                    DataNavigateUrlFields="IdPessoaEmail" UniqueName="IdPessoaEmail" DataNavigateUrlFormatString="javascript: ShowUpdateEmail({0})"
                                                    DataTextField="IdPessoaEmail">
                                                </telerik:GridHyperLinkColumn>
                                                <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Remover" CommandName="Delete" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="60px"></telerik:GridButtonColumn>
                                            </Columns>
                                            <CommandItemTemplate>
                                                <!-- -->
                                                <table border="0" style="width: 100%;" class="rgCommandTable">
	                                                <tbody>
	                                                    <tr>
		                                                    <td align="left">
		                                                        <input class="rgAdd" type="button" title=" Adicionar E-mail" onclick="return ShowInsertEmail();" />
                                                                <a href="#" onclick="return ShowInsertEmail();">Adicionar E-mail</a>
		                                                    </td>
	                                                    </tr>
                                                    </tbody>
                                                </table>
                                                <!-- -->
                                            </CommandItemTemplate>
                                        </MasterTableView>
                                    </telerik:RadGrid>
                                
                                </td>
                            </tr>
                        </table>
                        
                    </td>
                </tr>
            </table>
        
        </td>
    </tr>
</table>

</asp:Content>

